134f262a5422ec992cf379bfa3b9c2ee74a99ce6,config/app/src/main/java/com/google/samples/quickstart/config/MainActivity.java,MainActivity,fetchDiscount,#,100
Before Change
// more than cacheExpiration seconds ago. Thus the next fetch would go to the server unless
// throttling is in progress. The default expiration duration is 43200 (12 hours).
mFirebaseRemoteConfig.fetch(cacheExpiration)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "Fetch Succeeded");
// Once the config is successfully fetched it must be activated before newly fetched
// values are returned.
mFirebaseRemoteConfig.activateFetched();
displayPrice();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Throwable throwable) {
Log.d(TAG, "Fetch failed");
mPriceTextView.setText(mFirebaseRemoteConfig.getString(PRICE_PREFIX_CONFIG_KEY) +
mFirebaseRemoteConfig.getLong(PRICE_CONFIG_KEY));
}
});
// [END fetch_config_with_callback]
}
After Change
// more than cacheExpiration seconds ago. Thus the next fetch would go to the server unless
// throttling is in progress. The default expiration duration is 43200 (12 hours).
mFirebaseRemoteConfig.fetch(cacheExpiration)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d(TAG, "Fetch Succeeded");
// Once the config is successfully fetched it must be activated before newly fetched
// values are returned.
mFirebaseRemoteConfig.activateFetched();
} else {
Log.d(TAG, "Fetch failed");
}
displayPrice();
}
});
// [END fetch_config_with_callback]
}